home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / gamesmaster / source / asm / screendemos / scrollscreen336.s < prev    next >
Encoding:
Text File  |  1996-09-11  |  3.5 KB  |  128 lines

  1. ;Scroll Screen 336
  2. ;-----------------
  3. ;This demo allows you to legally scroll up to 50 screens in either
  4. ;direction by setting the HBUFFER flag.  Normally we would blit blocks down
  5. ;the left and right hand side to give an impression of heaps of screens -
  6. ;maybe later...
  7.  
  8.     opt    o+
  9.  
  10.     INCLUDE    "exec/exec_lib.i"
  11.     INCLUDE    "games/games_lib.i"
  12.     INCLUDE    "games/games.i
  13.  
  14. CALL    MACRO
  15.     jsr    _LVO\1(a6)
  16.     ENDM
  17.  
  18.     SECTION    "ScrollScreen336",CODE
  19.  
  20. ;===========================================================================;
  21. ;                             INITIALISE DEMO
  22. ;===========================================================================;
  23.  
  24. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  25.     move.l    ($4).w,a6
  26.     lea    GMS_Name(pc),a1
  27.     moveq    #$00,d0
  28.     CALL    OpenLibrary
  29.     move.l    d0,GMS_Base
  30.     beq.s    Quit
  31.  
  32.     move.l    GMS_Base(pc),a6
  33.     CALL    SetUserPri
  34.  
  35.     lea    ScreenStruct(pc),a0
  36.     CALL    Add_Screen
  37.     tst.l    d0
  38.     bne.s    Error
  39.  
  40.     lea    Picture(pc),a1           ;a1 = Picture struct.
  41.     move.l    SS_MemPtr1(a0),PIC_Data(a1)
  42.     lea    PicFile(pc),a0           ;a0 = Picture file.
  43.     CALL    LoadPic
  44.     tst.w    d0
  45.     bne.s    ReturnToDOS
  46.  
  47.     lea    ScreenStruct(pc),a0  ;Now show the screen/pic.
  48.     CALL    Show_Screen
  49.  
  50.     moveq    #JPORT1,d0           ;Initialise the mouse port.
  51.     CALL    Read_Mouse
  52.  
  53. ;===========================================================================;
  54. ;                                MAIN LOOP
  55. ;===========================================================================;
  56.  
  57. Loop:    moveq    #JPORT1,d0
  58.     CALL    Read_Mouse
  59.     btst    #MB_LMB,d0
  60.     bne.s    ReturnToDOS
  61.     asr.w    #8,d0                ;d0 = X Change
  62.     add.w    d0,SS_PicXOffset(a0)
  63.     CALL    Move_Picture
  64.     CALL    Wait_OSVBL
  65.     bra.s    Loop
  66.  
  67. ;===========================================================================;
  68. ;                              RETURN TO DOS
  69. ;===========================================================================;
  70.  
  71. ReturnToDOS:
  72.     move.l    GMS_Base(pc),a6
  73.     lea    ScreenStruct(pc),a0
  74.     CALL    Delete_Screen        ;Give back screen memory etc.
  75. Error:    move.l    GMS_Base(pc),a1
  76.     move.l    ($4).w,a6
  77.     CALL    CloseLibrary
  78. Quit:    MOVEM.L    (SP)+,A0-A6/D1-D7
  79.     moveq    #$00,d0
  80.     rts
  81.  
  82. ;===========================================================================;
  83. ;                                  DATA
  84. ;===========================================================================;
  85.  
  86. GMS_Name:
  87.     dc.b    "games.library",0
  88.     even
  89. GMS_Base:
  90.     dc.l    0
  91.  
  92. AMT_PLANES =    5
  93.  
  94. ScreenStruct:
  95.     dc.l    "GSV1",0
  96.     dc.l    0,0,0            ;Screen_Mem1/2/3
  97.     dc.l    0                ;Screen link.
  98.     dc.l    Palette          ;Address of palette.
  99.     dc.l    0                ;Address of rasterlist.
  100.     dc.l    0                ;Amt of colours in palette.
  101.     dc.w    320,256,336,256  ;Screen & Pic Width/Height.
  102.     dc.w    AMT_PLANES       ;Amt_Planes
  103.     dc.w    0,0              ;X/Y Top Of Screen
  104.     dc.w    0,0              ;X/Y Pic Offset (for scrolling).
  105.     dc.l    HSCROLL|HBUFFER  ;Special attributes.
  106.     dc.w    LORES            ;Screen mode.
  107.     dc.b    INTERLEAVED      ;Screen type
  108.     dc.b    0                ;Reserved.
  109.     even
  110.  
  111. Palette    dc.w    $0000,$0130,$0FCB,$0FA9,$0D88,$0965,$0644,$0211
  112.     dc.w    $0400,$0444,$0FF0,$0432,$0CC0,$0150,$0501,$0880
  113.     dc.w    $0261,$0271,$0382,$0492,$05A3,$05B4,$0677,$06C4
  114.     dc.w    $0788,$09AA,$0BCC,$0801,$0901,$0A02,$0701,$0601
  115.  
  116. Picture    dc.l    "PCV1",0           ;Version header.
  117.     dc.l    0                  ;Source data.
  118.     dc.w    336,256            ;Width, Height.
  119.     dc.w    AMT_PLANES         ;Amount of Planes.
  120.     dc.l    32                 ;Amount of colours.
  121.     dc.l    Palette            ;Source palette (remap).
  122.     dc.w    LORES              ;Screen mode.
  123.     dc.w    INTERLEAVED        ;Destination
  124.     dc.l    0                  ;Parameters.
  125.  
  126. PicFile    dc.b    "GAMESLIB:data/IFF.Pic336",0
  127.     even
  128.